package com.iss.demo.dao;

import com.iss.demo.entity.fourCourse;
import com.iss.demo.entity.sixCourse;
import com.iss.demo.model.sixCourseModel;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface sixCourseDao {


        @Select("select * from sixcourse ")
        List<sixCourseModel> selectAll();


        @Delete(" <script>"+"delete from sixcourse where s_id in" +
                "    <foreach collection=\"array\" item=\"id\" separator=\",\" open=\"(\" close=\")\">" +
                "        #{id}" +
                "    </foreach></script>")
        public Integer delete(Integer[] f_ids);
//    @Delete("delete from sixcourse where f_id=#{f_id}")
//    public Integer deleteOne(Integer f_id);

        @Insert("insert into sixcourse values(null,#{s_name},#{s_time},#{s_price},#{s_des},3,null,null)")
        public Integer insertCourse(sixCourse sixcourse);

        @Update("update sixcourse set s_name=#{s_name},s_time=#{s_time},s_price=#{s_price},s_des=#{s_des} where s_id=#{s_id}")
        public Integer updateCourse(sixCourse sixcourse);

        @Select("select * from sixcourse where s_id=#{s_id}")
        public sixCourse selectByid(Integer id);

        @Select("select s_name,s_price from sixcourse where s_id=#{s_id}")
        public sixCourse shopcar(Integer id);
        @Update("update sixcourse set s_surface = #{surface},s_info = #{info} where s_id=#{id}")
        public Integer updateInfo(@Param("surface") String surface,@Param("info") String info,@Param("id") Integer id);


}